package com.demiroot.server;

import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class FileNotFoundResponse implements HTTPResponse {
	String name;
	Config c;
	
	public FileNotFoundResponse(String name, Config c) {
		this.name = name;
		this.c = c;
	}

	@Override
	public byte[] getMessageAsByteArray() {
		return ServerUtils.stringToByteArray((String) getMessage());
	}

	@Override
	public int getCode() {
		return 404;
	}

	@Override
	public HeaderData getHeader() {
		return null;
	}
	
	@Override
	public Object getMessage() {
		Map<String, String> swap = new HashMap<String, String>();
		swap.put("$File", name);
		return ServerUtils.generateFileFromTemplate("404", swap, c);
	}

	@Override
	public ResponseType getResponseType() {
		return ResponseType.STRING;
	}

	@Override
	public List<Cookie> getCookies() {
		return null;
	}

	@Override
	public Calendar cookieExpire() {
		return null;
	}
}
